package com.hxgis.common.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class FileUtil {

    // 读取文件内容
    public static List<String> readFile(String path) {//路径
        List<String> lines = new ArrayList<String>();
        File file = new File(path);
        StringBuilder result = new StringBuilder();
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));//构造一个BufferedReader类来读取文件
            String s = null;
            while ((s = br.readLine()) != null) {//使用readLine方法，一次读一行
                lines.add(s);
            }
            br.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return lines;
    }


//    public static void main(String[] args) {
//        String s = readFile("E:\\qqDownload\\97242975\\FileRecv\\国界.txt");
//        System.out.println(s);
//    }



}
